<%@ page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false"
    pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>源IP提取记录视图</title>
<%@ include file="/base/base.jsp" %>

<script type="text/javascript">
//表格列数据
var columns=[
	{display:"序号",width:80,render:function(rowData,rowIndex){
		return (parseInt(this.get("page"))-1)*parseInt(this.get("pageSize"))+rowIndex+1;
	}},
	{display:"提取时间",width:130,name:"createTimeStr"},
	{display:"提取方式",name:"extractMode",width:130},
	{display:"开始时间",name:"beginTimeStr",width:130},
	{display:"结束时间",name:"endTimeStr",width:130},
	{display:"花费时间",name:"expendTimeStr",width:130,render:function(data){
		return data.expendTime+" ms";
	}},
	{display:"IP数量",name:"extractNum",width:130},
	{display:"状态",name:"state",width:130}
];
$(function(){
	initTime();
	initGrid();
	search();
});
//初始化日期时间
function initTime(){
	var now=new Date();
	var year=now.getFullYear();
	var month=now.getMonth()+1;
	month=month<10?"0"+month:month+"";
	var date=now.getDate();
	date=date<10?"0"+date:date+"";
	var hour=now.getHours();
	hour=hour<10?"0"+hour:hour+"";
	var minute=now.getMinutes();
	minute=minute<10?"0"+minute:minute+"";
	var second=now.getSeconds();
	second=second<10?"0"+second:second+"";
    var start=year+"-"+month+"-"+date+" "+(hour-1)+":"+minute+":"+second;
	var end=year+"-"+month+"-"+date+" "+hour+":"+minute+":"+second;
	$("#beginTimeStr").val(start);
	$("#endTimeStr").val(end);

	
}

function initGrid(){
	var url="<%=request.getContextPath()%>/monitor/sourceRecord/search.action";
	$("#ressult_div").ligerGrid({
		height:'100%',
		width:'100%',
		columns:columns,
		enabledSort:false,
		pageSize:50,
		root:"result",//数据集合
		record:"dataSize",//总数据数
		pageParmName:"pageIndex",//页索引
		pagesizeParmName:"pageLen",//页长
		usePager:true,
		dataAction:"server",
		method:"post",
		delayLoad:true,//初始化不加载
		pageSizeOptions:[20,50,100,200],
		url:url
	
	});
	var manager = $("#ressult_div").ligerGetGridManager(); 
	manager.set("height","100%");
}
function search(){
	
	var startDate=$.trim($("#beginTimeStr").val()).replace(/-/g,"/");
	var endDate=$.trim($("#endTimeStr").val()).replace(/-/g,"/");
	var start=new Date(startDate);
	var end=new Date(endDate);
	if(start.getTime()>end.getTime()){
		 $.ligerDialog.warn('开始时间不能小于结束时间');
		return;
	}
	var url="<%=request.getContextPath()%>/monitor/sourceRecord/search.action";
	var manager = $("#ressult_div").ligerGetGridManager(); 
    manager.set("newPage",1);
    
    manager.set("url",url+"?"+encodeURI(encodeURI(decodeURIComponent($('#sourceRecord_form').serialize(),true))));
}

function resetSearch(){
	$("#beginTimeStr").val("");
	$("#endTimeStr").val("");
	$("#extractMode").val("");
}

</script>
</head>
<body>

<div class="main"  style="height:100%">
	<div class="form_body">
		<form id="sourceRecord_form" >
		<div class="form_body_tltle">源IP提取记录视图</div>
		<table id="result_table" class="form_table">
			<tr style="height:40px;" >
				<td>&nbsp;&nbsp;检索时间&nbsp;&nbsp;
					<input type="text"
					onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd HH:mm:ss'});"
					readonly="readonly" id="beginTimeStr" name="c.beginTimeStr"
					/>
					&nbsp;至
					<input type="text" 
					onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd HH:mm:ss'});"
					readonly="readonly" id="endTimeStr" name="c.endTimeStr"
					/>
					&nbsp;&nbsp;IP提供商
					<!-- 目前只能写死，只有两个，以后可以动态 -->
					<select name="c.extractMode" id="extractMode">
						<option value="">--全部--</option>
						<option value="代理666">代理666</option>
						<option value="欣欣代理">欣欣代理</option>
					</select>
					<input type="button"  id="" value="查询" class="" onclick="search()"/>
					<input type="button"  id="" value="清空" class="" onclick="resetSearch()"/>
				</td>
			</tr>
			
		</table>
		</form>
	</div>
	<div style="height:25px;border:0px;"></div>
	<div id="ressult_div" style="height:100%"><span/></div>
</div>
</body>
</html>